<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>限制只能输入数字</title>
    <link rel="stylesheet" type="text/css" href="../../common/sui.css">
    <style type="text/css">
        .box {
            width: 500px;
            margin: 20px auto 0;
            padding: 40px 20px;
        }
    </style>
</head>

<body>
    <form class="box sui-form form-horizontal sui-validate">
        <input type="text" placeholder="限制只能输入数字">
    </form>
    <script type="text/javascript" src="../../common/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".box input[type='text']").on("focus blur keyup", function () {
                this.value = this.value.replace(/\D/g, '');
            });
        });
    </script>
</body>

</html>